﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DuelQuizz.contract;
using DuelQuizzServer;

namespace DuelQuizz.Views
{
    /// <summary>
    /// Logique d'interaction pour NotificationsPage.xaml
    /// </summary>
    public partial class NotificationsPage : UserControl
    {
        private MainPage main_page;

        public NotificationsPage(MainPage main_page)
        {
            this.main_page = main_page;
            InitializeComponent();

            //Notifications.ItemsSource = main_page.user.notifications;

            foreach (Notification n in main_page.user.notifications)
            {
                if (!n.is_read)
                    Notifications.Items.Add(n);
            }

            AppServices.getDuelQuizzServices().readAllNotifications();

        }

        private void Button_Click_Retour(object sender, RoutedEventArgs e)
        {
            MainWindow.changeWindows(main_page);
            MainPage.refreshNotification();
        }
    }
}
